﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Sales_Order.aspx.cs" Inherits="Reports_Sales_Order" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <link href="../resources/styles/style.css" type="text/css" rel="stylesheet" />
    <link href="../js/themes/default/easyui.css" rel="stylesheet" type="text/css" />
    <script src="../js/jquery-1.7.1.min.js" type="text/javascript"></script>
    <script src="../js/jquery.easyui.min.js" type="text/javascript"></script>
    <script src="../js/highcharts.js" type="text/javascript"></script>
    <script src="../js/exporting.js" type="text/javascript"></script>
    <script src="../JavaScript/My97DatePicker/WdatePicker.js" type="text/javascript"></script>
    <script type="text/javascript">
        function ShowGrid() {
            var name = $('#showType option:selected').text();
            var columns = [[
    { field: 'NAME', title: name, width: 200, sortable: true },
    { field: 'C_S', title: '今日销量', width: 100, sortable: true },
    { field: 'B_S', title: '本月销量', width: 80, sortable: true },
    { field: 'A_S', title: '上月销量', width: 80, sortable: true },
    { field: 'D_S', title: '去年同期', width: 80, sortable: true },
    { field: 'E_S', title: '同比', width: 80, sortable: true, formatter: function (value, rec) {
        if (value == "") return value; else return (value > 0) ? "<span style='color:green;'>" + value + "% ↑</span>" : "<span style='color:red;'>" + value + "% ↓</span>";
    }
    },
    { field: 'F_S', title: '环比', width: 80, sortable: true, formatter: function (value, rec) {
        if (value == "") return value; else return (value > 0) ? "<span style='color:green;'>" + value + "% ↑</span>" : "<span style='color:red;'>" + value + "% ↓</span>";
    }
    }
    ]];

            $('#dg').datagrid({
                width: $('#wsd_inputtable').width(),
                height: 400,
                rownumbers: true,
                columns: columns
            });
        }

        function SelectClick() {
            var dataArr = "{'Domain_ID': '<%= MyStateManager.DomainID %>', 'ShowType':'" + $('#showType').val() + "'}";
            $.ajax({
                url: "Sales_Order.aspx/SelectMethodDate",
                data: dataArr,
                type: "post",
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function (getdata) {
                    if (getdata.d == "") {
                        $.messager.alert('提示消息', '查询无相关数据!', 'info');
                    }
                    else {
                        var data = eval('(' + getdata.d + ')');
                        ShowGrid();
                        $('#dg').datagrid('loadData', data.rows);
                    }
                },
                error: function (xhr) {
                    $.messager.alert('警告消息', xhr.responseText, 'warning');
                }
            });
        }


        $(function () {
            ShowGrid();
            $('#bt_select').click(function () {
                SelectClick();
            });
        });
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <table id="wsd_inputtable">
        <tr>
            <td class="tabletitle" colspan="4">
                查询条件
            </td>
        </tr>
        <tr>
            <td class="tablefield" style="width: 100px">
                显示维度
            </td>
            <td>
                <select id="showType" style="width: 100px">
                    <option value="C">门店</option>
                    <option value="O">门店类型</option>
                    <option value="U">人员</option>
                </select>
            </td>
            <td>
            </td>
        </tr>
        <tr>
            <td class="buttonarea" colspan="4">
                <input type="button" class="wsd_button2" value="查 询" id="bt_select" />
            </td>
        </tr>
    </table>
    <br />
    <div style="width: 100%">
        <table id="dg">
        </table>
    </div>
    </form>
</body>
</html>
